﻿
/// <summary>
/// Pager 的摘要说明
/// </summary>
public class Paging
{
    /// <summary>
    /// 分页操作
    /// </summary>
    /// <param name="page">当前索引页</param>
    /// <param name="lastPage">尾页</param>
    /// <param name="jsFn">JS跳转函数名 如：getcutpage(1)则输入getcutpage</param>
    public string HtmlCutPages(int page,int lastPage,string jsFnNname)
    {
        System.Text.StringBuilder htmlCutPage = new System.Text.StringBuilder("");
        htmlCutPage.Append(string.Format("<a href=\"javascript:;\" onclick=\"{0}('0')\">首页</a>&nbsp;",jsFnNname));
        htmlCutPage.Append(string.Format("<a href=\"javascript:;\" onclick=\"{0}('{1}')\">上一页</a>&nbsp;",jsFnNname, page - 1));
        htmlCutPage.Append(string.Format("<a href=\"javascript:;\" onclick=\"{0}('{1}')\">下一页</a>&nbsp;",jsFnNname, page + 1));
        htmlCutPage.Append(string.Format("<a href=\"javascript:;\" onclick=\"{0}('{1}')\" >尾页</a>&nbsp; {2}/{1}\r\n",jsFnNname, lastPage, page));
        htmlCutPage.Append("<input name=\"txtNum\" type=\"text\" id=\"txtNum\" size=\"2\" maxlength=\"10\" onkeypress=\"javascript:if( event.keyCode == 13){$('#Go').focus();return false;} \" />");
        htmlCutPage.Append(string.Format("<input type=\"button\" name=\"Go\" id=\"Go\" value=\"Go\" onclick=\"{0}($('#txtNum').val())\" />",jsFnNname));
        return htmlCutPage.ToString();
    }
}




